//一组函数，方法操作的库。原始js库。
var Movie = require('../app/controllers/Movie.js')
var Index = require('../app/controllers/Index.js')
var User = require('../app/controllers/User.js')
var Comment = require('../app/controllers/Comment.js')
var Catetory = require('../app/controllers/Catetory.js')

module.exports=function(app){
	//index
	app.get('/',Index.index);

	//user
	app.post('/user/signup',User.signup);
	app.post('/user/signin',User.signin)
	app.get("/logout",User.logout)
	app.get("/signin",User.showSignin)
	app.get("/signup",User.showSignup)
	app.get("/admin/user/list",User.signinRequried,User.adminRequried,User.userlist)

	//movie
	app.get('/movie/:id',Movie.detail)
	app.get('/admin/movie/new',User.signinRequried,User.adminRequried,Movie.new)
	app.get('/admin/movie/update/:id',User.signinRequried,User.adminRequried,Movie.update)
	app.post('/admin/movie',User.signinRequried,User.adminRequried,Movie.savePoster,Movie.save)
	app.get('/admin/movie/list',User.signinRequried,User.adminRequried,Movie.list)
	app.delete('/admin/movie/list',User.signinRequried,User.adminRequried,Movie.del)

	//comment
	app.post('/user/comment',User.signinRequried,Comment.save)

	//catetories
	app.get('/admin/catetory/new',User.signinRequried,User.adminRequried,Catetory.new)
	app.post('/admin/catetory',User.signinRequried,User.adminRequried,Catetory.save)
	app.get('/admin/catetory/list',User.signinRequried,User.adminRequried,Catetory.list)

	//
	app.get('/results',Index.search)
}